package com.lehuowujie.lehuomarket.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by EvangelineLy on 2017/1/15.
 */
public class IndicatorFragment extends Fragment {

    public static final String BUNDLE_KEY = "bundle_key";

    private String mTitle;

    public static IndicatorFragment newInstance(String title) {
        Bundle bundle = new Bundle();
        bundle.putString(BUNDLE_KEY, title);
        IndicatorFragment fragment = new IndicatorFragment();
        fragment.setArguments(bundle);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Bundle bundle = getArguments();
        TextView tv = new TextView(getContext());
        if (bundle != null) {
            mTitle = bundle.getString(BUNDLE_KEY);
        }
        tv.setText(mTitle);
        tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
        tv.setTextColor(Color.parseColor("#CCFFFFFF"));
        tv.setGravity(Gravity.CENTER);
        return tv;
    }
}
